package com.example.JPetStore.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.JPetStore.Common;
import com.example.JPetStore.domain.Product;
import com.example.JPetStore.domain.User;
import com.example.JPetStore.mappers.ProductMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.example.JPetStore.mappers.ProductMapper;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

@Service
public class ProductDao {

    @Autowired
    ProductMapper productMapper;

    public ArrayList<Product> queryProducts(String cateId) {
        List<Product> productList = productMapper.selectList(new QueryWrapper<Product>().eq("cate_id", cateId));
        System.out.println(productList);
        ArrayList<Product> productArrayList = new ArrayList<>(productList);
        return productArrayList;

    }
}

